package com.haier.tv.mic.detect.manager;

public class HaierMicManager {

    private static String TAG = HaierMicManager.class.getSimpleName();
    private static HaierMicManager instance ;

    public static synchronized HaierMicManager getHaierMicManager(){

        if (null == instance)
            instance = new HaierMicManager();

        return instance;
    }

    // Used to load the 'detect' library on application startup.
    static {
        System.loadLibrary("detect");
    }

    public int getMicNum(){
        return nativeGetMicNum();
    }

    public boolean checkMicOk(){
        return isMicOk();
    }

    public String getPropertyString(String key,String def){
        return nativeGetPropertyString(key,def);
    }

    public boolean micInit(int channelNum,int sampleRate){
        return nativeMicInit(channelNum,sampleRate);
    }

    public boolean micDeInit(){
        return nativeMicDeInit();
    }

    /**
     * A native method that is implemented by the 'detect' native library,
     * which is packaged with this application.
     */
    private native boolean isMicOk();
    private native int nativeGetMicNum();
    private native String nativeGetPropertyString(String key,String def);

    private native boolean nativeMicInit(int channelNum,int sampleRate);
    private native boolean nativeMicDeInit();
}
